#!/usr/bin/python

import sys
import bsddb


if __name__ == "__main__":
 
    db_fname = sys.argv[1]

    cnt_all = 0
    db = bsddb.btopen(db_fname, 'w')
    for key, value in (line.split() for line in sys.stdin):
        cnt_all += 1
        db[key] = value

    db.sync()
    db.close()

    print "Done! (%s)" % (cnt_all,)

